<admintpl file="header" />
<style>
<!--
.trsel {
	background-color: #DFEBF2;
}
-->
</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a>考试报名管理</a></li>
		</ul>
		<form class="well form-search" method="post" action="{:U('Exams/signin_list')}">
			考试分类： 
			<select name="exam_term_id" id="exam_term" style="width: 120px;">
				<option value='0'>全部</option>{$exam_taxonomys}
			</select> &nbsp;&nbsp;
			工种： 
			<select name="ques_term_id" id="ques_term" style="width: 120px;">
				<option value='0'>全部</option>{$ques_taxonomys}
			</select> &nbsp;&nbsp;
			考试： 
			<select name="exam_id" id="exam_id">
			<option value="0">请选择考试</option>
			<volist name="exam_list" id="exam">
			<option value="{$exam.id}">[ID:{$exam.id}]{$exam.exam_name}</option>
			</volist>
			</select>
			
			<button class="btn btn-primary" id="btn_showsign" type="button" onclick="showSignin()">考试报名情况查看</button>
		</form>
		<form method="post" class="js-ajax-form">
			<input type="hidden" value="" name="exam_id" id="signin_exam_id"></input>
			<div class="table-actions">
				<button class="btn btn-primary js-ajax-submit" type="submit" data-action="{:U('Exams/signin_post')}" data-subcheck="true" data-msg="您确定为以下选中员工报名吗？">指定报名考试资格</button>
				<button class="btn btn-danger js-ajax-submit" type="submit" data-action="{:U('Exams/signin_delete')}" data-subcheck="true" data-msg="您确定要取消选中员工的报名信息吗？">取消报名资格</button>
			</div>
			<table class="table table-hover table-bordered">
				<thead>
					<tr><th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
						<th align="center">ID</th>
						<th>登陆名/登陆手机号</th>
						<th>姓名/昵称</th>
						<th>工号</th>
						<th>单位</th>
						<th>用户代码</th>
						<th>注册时间</th>
						<th>最后登陆时间</th>
						<th>最后登陆IP</th>
					</tr>
				</thead>
				<tbody>
					<php>$user_statuses=array("0"=>L('USER_STATUS_BLOCKED'),"1"=>L('USER_STATUS_ACTIVATED'),"2"=>L('USER_STATUS_UNVERIFIED'));</php>
					<foreach name="list" item="vo">
					<tr>
						<td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.id}" title="ID:{$vo.id}"></td>
						<td align="center">{$vo.id}</td>
						<td>{$vo['user_login']?$vo['user_login']:($vo['mobile']?$vo['mobile']:L('THIRD_PARTY_USER'))}</td>
						<td>{$vo['user_nicename']?$vo['user_nicename']:""}</td>
						<td>{$vo.psn_num}</td>
						<td><notempty name="vo['dept_code']">({$vo.dept_code})</notempty>{$vo.dept}</td>
						<td>{$vo.psn_code}</td>
						<td>{$vo.create_time}</td>
						<td>{$vo.last_login_time}</td>
						<td>{$vo.last_login_ip}</td>						
					</tr>
					</foreach>
				</tbody>
			</table>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/layer/layer.js"></script>
	<script type="text/javascript">
	function showSignin(){
		var exam_id=$('#exam_id').val();
		var url="{:U('Exams/users')}"+"&exam_id="+exam_id;
		layer.open({
		      type: 2,
		      title: '报名及考试情况查看',
		      shadeClose: true,
		      shade: false,
		      maxmin: true, //开启最大化最小化按钮
		      area: ['893px', '570px'],
		      content: url,
		      success:function(layero, index){
		    	  //layer.full(index);
		      }
		});
	}
	function loadExams(ques_term,exam_term){
		$.ajax({
			url:"{:U('exams/get_exams_json')}",
			data:{"ques_term":ques_term,"exam_term":exam_term},
			type:'POST',
			async:true,
			timeout:5000,    //超时时间
		    dataType:'json',
		    success:function(data,textStatus,jqXHR){

		    	if(data.status==1){
					var lst_exam=data.content;
					var arr_option=[];
					$('#exam_id').empty();
		    		$('#exam_id').append('<option value="0">↓请选择考试['+lst_exam.length+']↓</option>');
					for(var exam in lst_exam){
						$('#exam_id').append('<option value="'+lst_exam[exam].id+'">[ID:'+lst_exam[exam].id+']'+lst_exam[exam].exam_name+'</option>');
					}
		    	}
		    	else{
		    		$('#exam_id').empty();
		    		$('#exam_id').append('<option value="0">↓请选择考试[0]↓</option>');
		    		
		    	}

		    	$('#exam_id').val('{$exam_id}');

		    	if($('#exam_id').val()==0)
		    		$('#btn_showsign').attr('disabled');
		    	else
		    		$('#btn_showsign').removeAttr('disabled');

		    	
				console.log($('#exam_id').val());
		    	$('#signin_exam_id').val('{$exam_id}');		    	
			}
		});

    	if($('#exam_id').val()==0)
    		$('#btn_showsign').attr('disabled');
    	else
    		$('#btn_showsign').removeAttr('disabled');
		console.log($('#exam_id').val());
	}
	$('#exam_id').change(function(){
		$('#signin_exam_id').val($('#exam_id').val());
		if($('#exam_id').val()==0)
			$('#btn_showsign').attr('disabled',true);
		else
			$('#btn_showsign').removeAttr('disabled');
		console.log($('#exam_id').val());
	});
	$('#ques_term').change(function(){
		loadExams($(this).val(),$('#exam_term').val());
	});
	$('#exam_term').change(function(){
		loadExams($('#ques_term').val(),$(this).val());
	});
	$('#ques_term').change();

	$("tbody tr").click(function() {
		$(this).toggleClass('trsel');
		var chk = $(this).find(":checkbox");
		$(this).find(":checkbox").attr("checked",!$(chk).attr("checked"));
	});
	</script>
</body>
</html>